package com.example.myskyjava.controller;

import com.example.myskyjava.ThrowData.Result;
import com.example.myskyjava.service.ImportRead;
import com.example.myskyjava.service.ImportService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("/admin")

public class ImportExl {
    @Resource
    private ImportService importService;

    @Resource
    private ImportRead importRead;


    @PostMapping(value="/importExcel", produces = "application/json")
    @ResponseBody
    public Result importExl(@RequestParam("uploadExcelFile") MultipartFile uploadExcelFile) throws IOException {
        String filepath = uploadExcelFile.getOriginalFilename();
        System.out.println(filepath);
//        写入
//        importService.simpleWrite();

//        读取
        importRead.simpleRead(uploadExcelFile);
        return null;
    };
}
